{% extends "base.html" %}

{% block title %}设备详情{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h4 class="mb-0">{{ equipment.name }}</h4>
                    {% if current_user.role in ['engineer', 'manager'] %}
                    <a href="{{ url_for('main.edit_equipment', equipment_id=equipment.id) }}" 
                       class="btn btn-outline-primary btn-sm">
                        <i class="fas fa-edit me-1"></i>编辑
                    </a>
                    {% endif %}
                </div>
                <div class="card-body">
                    <dl class="row">
                        <dt class="col-sm-3">型号</dt>
                        <dd class="col-sm-9">{{ equipment.model }}</dd>
                        
                        <dt class="col-sm-3">设备类型</dt>
                        <dd class="col-sm-9">
                            {% if equipment.type == 'sensor' %}传感器
                            {% elif equipment.type == 'controller' %}控制器
                            {% elif equipment.type == 'actuator' %}执行器
                            {% endif %}
                        </dd>
                        
                        <dt class="col-sm-3">制造商</dt>
                        <dd class="col-sm-9">{{ equipment.manufacturer or '未知' }}</dd>
                        
                        <dt class="col-sm-3">单价</dt>
                        <dd class="col-sm-9">{{ "%.2f"|format(equipment.price or 0) }} 元</dd>
                        
                        <dt class="col-sm-3">技术规格</dt>
                        <dd class="col-sm-9">
                            <pre class="mb-0"><code>{{ equipment.specifications|tojson(indent=2) }}</code></pre>
                        </dd>
                        
                        <dt class="col-sm-3">创建时间</dt>
                        <dd class="col-sm-9">{{ equipment.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</dd>
                    </dl>
                </div>
                <div class="card-footer">
                    <a href="{{ url_for('main.equipment_list') }}" class="btn btn-secondary">
                        <i class="fas fa-arrow-left me-1"></i>返回列表
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 